<template>
	<view>
		<view>
			<view class="header">
				<view class="bg">
					<view class="box">
						<view class="box-hd">
							<view class="avator">
								<image src="../../static/boy.png" mode=""></image>
								<image :src="login ? uerInfo.avatarUrl :avatarUrl"></image>
							</view>
							<!-- <view class="phone-number">18909XXXX67</view> -->
							<view class="phone-number">
								<!-- <text class="uer-name">Hi，{{login ? uerInfo.name : '您未登录,请点击头像登录'}}</text> -->
								<text class="uer-name">{{CreateName}}</text>
							</view>
						</view>
						<view class="box-bd">
						<!-- 	<view class="item">
								<view class="icon">
									<image src="../../static/wkiwi-user/upload.png" mode=""></image>
								</view>
								<view class="text" @tap="onNavigationBarButtonTap">离线单据上传</view>
							</view>
							<view class="item">
								<view class="icon">
									<image src="../../static/wkiwi-user/change.png" mode=""></image>
								</view>
								<view class="text">切换状态</view>
							</view> -->
							<view class="item"  @tap="logoutbtn">
								<view class="icon">
									<image src="../../static/wkiwi-user/logout1.png" mode=""></image>
								</view>
								<view class="text">退出登录</view>
							</view>
						</view>
					</view>
				</view>
			</view>

			<view class="list-content">
				<view class="list">
					<view class="li noborder" @tap="bluetooth">
						<view class="icon">
							<image src="../../static/image/blue1.png" mode=""></image>
						</view>
						<view class="text">蓝牙配对</view>
						<image class="to" src="../../static/wkiwi-user/to.png"></image>
					</view>
					<view class="li noborder"  @tap="printSetting">
						<view class="icon">
							<image src="../../static/wkiwi-user/dayin.png" mode=""></image>
						</view>
						<view class="text">打印设置</view>
						<image class="to" src="../../static/wkiwi-user/to.png"></image>
					</view>
					<view class="li noborder" @tap="xpSetting">
						<view class="icon">
							<image src="../../static/wkiwi-user/xiaopiao.png" mode=""></image>
						</view>
						<view class="text">小票格式</view>
						<image class="to" src="../../static/wkiwi-user/to.png"></image>
					</view>
					<!-- <view class="li noborder">
						<view class="icon">
							<image src="../../static/wkiwi-user/edit.png" mode=""></image>
						</view>
						<view class="text">单据编辑</view>
						<image class="to" src="../../static/wkiwi-user/to.png"></image>
					</view> -->
				</view>
				<view class="list">
					<view class="li" @tap="gosetting">
						<view class="icon">
							<image src="../../static/wkiwi-user/xtsz.png" mode=""></image>
						</view>
						<view class="text">系统设置</view>
						<image class="to" src="../../static/wkiwi-user/to.png"></image>
					</view>
					<view class="li" @tap="danju" v-if="isShowQx">
						<view class="icon">
							<image src="../../static/wkiwi-user/power.png" mode=""></image>
						</view>
						<view class="text" >权限设定</view>
						<image class="to" src="../../static/wkiwi-user/to.png"></image>
					</view>
					<view class="li">
						<view class="icon">
							<image src="../../static/wkiwi-user/set.png" mode=""></image>
						</view>

						<view class="text" @tap="address">默认设置</view>
						<image class="to" src="../../static/wkiwi-user/to.png"></image>
					</view>
					<view class="li" @tap="barcode">
						<view class="icon">
							<image src="../../static/wkiwi-user/code.png" mode=""></image>
						</view>
						<view class="text">条码规则</view>
						<image class="to" src="../../static/wkiwi-user/to.png"></image>
					</view>
					<!-- <view class="li"  @tap="gosign">
						<view class="icon">
							<image src="../../static/wkiwi-user/dingwei.png" mode=""></image>
						</view>
						<view class="text">签到定位</view>
						<image class="to" src="../../static/wkiwi-user/to.png"></image>
					</view> -->
				</view>
			<!-- 	<view class="list">
					<view class="li noborder">
						<view class="icon">
							<image src="../../static/wkiwi-user/ftp.png" mode=""></image>
						</view>
						<view class="text">FTP下载</view>
						<image class="to" src="../../static/wkiwi-user/to.png"></image>
					</view>
					<view class="li noborder">
						<view class="icon">
							<image src="../../static/wkiwi-user/down.png" mode=""></image>
						</view>
						<view class="text">直接下载离线数据</view>
						<image class="to" src="../../static/wkiwi-user/to.png"></image>
					</view>
				</view> -->
				<view class="list">
					<!-- <view class="li noborder"  @tap="aboutedition">
						<view class="icon">
							<image src="../../static/wkiwi-user/about.png" mode=""></image>
						</view>
						<view class="text">关于版本</view>
						<image class="to" src="../../static/wkiwi-user/to.png"></image>
					</view>
					<view class="li noborder">
						<view class="icon">
							<image src="../../static/wkiwi-user/update.png" mode=""></image>
						</view>
						<view class="text">版本更新</view>
						<image class="to" src="../../static/wkiwi-user/to.png"></image>
					</view> -->
				</view>
			</view>
			<view class="out"></view>
		</view>
		<tab-bar :current="4"></tab-bar>
	</view>
</template>

<script>
	import tabBar from "../../components/tabBar.vue"
	export default {
		components: {
			tabBar,
		},
		data() {
			return {
				login: false,
				avatarUrl: "../../static/wkiwi-user/face.jpg",
				uerInfo: {
					name: "张三",
				},
				isShowQx:true,
				CreateName:""
			}
		},
		onShow(){
			let PDA_Module_Options = uni.getStorageSync("PDA_Module_Options");
			PDA_Module_Options = JSON.parse(PDA_Module_Options);
			var that = this;
			PDA_Module_Options.forEach((item,index)=>{
				if(item.ModuleName=="权限设定"){
					if(item.IsBill==''){
						this.isShowQx = false;					 
					}
				}
			});
		},
		onLoad(options){
			this.CreateName = uni.getStorageSync("UserName");
		},
		methods: {
			changeSkin() {
				uni.navigateTo({
					url: '../myColor/myColor'
				});
			},
			address() {
				uni.navigateTo({
					url: '../setting/DefaultSetting',
				});
			},
			danju(){
				uni.navigateTo({
					url: '../powersetting/powersetting',
				});
			},
			printSetting(){
				uni.navigateTo({
					url: '../printSetting/printSetting',
				});
			},
			xpSetting(){
				uni.navigateTo({
					url: '../setting/Receipts',
				});
			},
			onNavigationBarButtonTap(e) {
				const index = e.index;
				if (index === 0) {
					this.$api.msg('点击了扫描');
					uni.scanCode({
						success: (result) => {
							this.$api.msg('扫描成功' + result);
						},
						fail: (res) => {
							this.$api.msg('扫描成功' + res);
						}
					})
				} else if (index === 1) {
					this.$api.msg('扫描成功' + res);
				}
			},
			logoutbtn(){
				console.log("-------");
				uni.showModal({
					title:"提示",
					content:"是否退出登录?",
					success(res) {
						if(res.confirm){
							uni.clearStorage();
							uni.reLaunch({
								url:"../login/login"
							})
						}else{
							uni.showToast({
								title:"取消退出",
								duration:1000
							})
						}
					}
				})
				
			},
			aboutedition(){
				uni.navigateTo({
					url:"../edition/edition"
				})
			},
			gosetting(){
				uni.navigateTo({
					url:"../setting/setting"
				})
			},
			gosign(){
				uni.navigateTo({
					url:"../SignIn/SignIn"
				})
			},
			barcode(){
				uni.navigateTo({
					url:"../Barcode/Barcode"
				})
			},
			bluetooth(){
				uni.navigateTo({
					url:"../bluetooth/bluetooth"
				})
			}
			

		}
	}
</script>
<style lang="scss">
	page {
		background-color: #f1f1f1;
		font-size: 30upx;
	}

	.header {
		background: #fff;
		height: 290upx;
		padding-bottom: 110upx;

		.bg {
			width: 100%;
			height: 200upx;
			padding-top: 100upx;
			background-color: rgba(124, 170, 216, 1);
		}
	}

	.box {
		width: 650upx;
		height: 280upx;
		border-radius: 20upx;
		margin: 0 auto;
		background: #fff;
		box-shadow: 0 5upx 20upx 0upx rgba(0, 0, 150, .2);

		.box-hd {
			display: flex;
			flex-wrap: wrap;
			flex-direction: row;
			justify-content: center;

			.avator {
				width: 160upx;
				height: 160upx;
				background: #fff;
				border: 5upx solid #fff;
				border-radius: 50%;
				margin-top: -80upx;
				overflow: hidden;

				img {
					width: 100%;
					height: 100%;
				}
			}

			.phone-number {
				width: 100%;
				text-align: center;
			}
		}

		.box-bd {
			display: flex;
			flex-wrap: nowrap;
			flex-direction: row;
			justify-content: center;

			.item {
				flex: 1 1 auto;
				display: flex;
				flex-wrap: wrap;
				flex-direction: row;
				justify-content: center;
				border-right: 1px solid #f1f1f1;
				margin: 15upx 0;

				&:last-child {
					border: none;
				}

				.icon {
					width: 60upx;
					height: 60upx;

					img {
						width: 100%;
						height: 100%;
					}
				}

				.text {
					width: 100%;
					text-align: center;
					margin-top: 10upx;
				}
			}
		}
	}

	.list-content {
		background: #fff;
		padding-top: 80upx;
		;
	}

	.list {
		width: 100%;
		border-bottom: 15upx solid #f1f1f1;
		background: #fff;

		&:last-child {
			border: none;
		}

		.li {
			width: 100%;
			height: 100upx;
			padding: 0 4%;
			border-bottom: 1px solid rgb(243, 243, 243);
			display: flex;
			align-items: center;

			&.noborder {
				border-bottom: 0
			}

			.icon {
				flex-shrink: 0;
				width: 50upx;
				height: 50upx;

				image {
					width: 50upx;
					height: 50upx;
				}
			}

			.text {
				padding-left: 20upx;
				width: 100%;
				color: #666;
			}

			.to {
				flex-shrink: 0;
				width: 40upx;
				height: 40upx;
			}
		}
	}

	.out {}
</style>
